# -*- coding: utf-8 -*-
from concurrent import futures

import time
from concurrent.futures import ThreadPoolExecutor


def get_html(times):
    time.sleep(times)
    print('get page %s success' % times)
    return times


executor = ThreadPoolExecutor(max_workers=2)
task1 = executor.submit(get_html, (3))
task2 = executor.submit(get_html, (2))

print(task1.result())
print("task2.cancel", task2.cancel())
print(task1.done())
time.sleep(5)
print(task1.done())
